<template>
	<!-- 我是供货商我有商品入驻 -->
	<!-- 我是店铺我开店 -->
	<!-- 店铺入驻协议 -->
	<view class="page_box">
		<view class="content">
			<view class="">
				<view class="info" @click="jump_a" v-if="!sid">
					店铺入驻
				</view>
				<view class="info" @click="jump_a" v-else>
					店铺修改
				</view>
			</view>
			<view class="info" @tap="jump('/pages/user/management')" v-if="sid">
				商品管理
			</view>
			<!-- management -->
		</view>
		<!-- 弹出选择 -->
		<u-select v-model="show" :list="list" @confirm="confirm" default-value=[1]  ></u-select>
		<!-- 自定义底部导航 -->
		<shopro-tabbar></shopro-tabbar>
		<!-- 关注弹窗 -->
		<shopro-float-btn></shopro-float-btn>
		<!-- 连续弹窗提醒 -->
		<shopro-notice-modal></shopro-notice-modal>
		<!-- 登录提示 -->
		<shopro-login-modal></shopro-login-modal>
	</view>
</template>

<script>
import shoprpCoupon from '@/components/shopro-coupon/shopro-coupon.vue';
export default {
	components: {
		shoprpCoupon
	},
	data() {
		return {
			dizhi: '',
			sid:"",
			show:false,
			list:[
				{value:'0',label:'商家入驻'},
				{value:"1",label:'我是供货商'}
			]
		};
	},
	onShow() {
		this.dizhi = uni.getStorageSync('dizhi');
		uni.removeStorageSync('dizhi');
		console.log('this.dizhi :>> ', this.dizhi);
	},
	onLoad() {
		
		this.getUsers();
		
	},
	methods: {
		jump(path, query) {
			this.$Router.push({
				path: path,
				query: query
			});
		},
		jump_a(){
			this.show=true
		},
		// 获取店id
		async usermerchants(uid) {
			const res = await this.$api('usermerchants', {
				uid: uid
			});
			this.sid = res;
			if(res){
				this.list[0].label='商家修改'
			}else{
				this.list[0].label='商家入驻'
			}
			console.log('sid :>> ', this.sid);
		},

		// 获取用户的id
		async getUsers() {
			const res = await this.$api('user.info');

			var uid = res.data.id;
			this.usermerchants(uid);
			console.log('uid :>> ', uid);
			
		},
		//选择
		confirm(e){
			console.log('e 选择:>> ', e);
			if(e[0].value==0){
			
				uni.navigateTo({
					url:'listt33?inde=1'
				})
			}else{
				uni.r
				
				uni.navigateTo({
					url:'listt33?inde=2'
				})
			}
		}
	}
};
</script>

<style lang="scss">
.page_box {
	.content {
		width: 100vw;
		height: 100vh;
		overflow: scroll;
		background-color: #f5f8fd;
		.info {
			display: flex;
			align-items: center;
			margin: 0 auto;
			width: 690rpx;
			height: 100rpx;
			background: #ffffff;
			border-radius: 10rpx;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			margin-top: 30rpx;
			padding-left: 30rpx;
		}
	}
}
</style>
